package dominio;

import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.JFrame;
import javax.swing.JOptionPane;

import presentacion.Messages;

public class ListenerCerrarVentana extends WindowAdapter {
	JFrame frame;
	public ListenerCerrarVentana(JFrame frame){
		this.frame=frame;
	}
	@Override
	public void windowClosing(WindowEvent arg0) {
		frame.setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
		if(JOptionPane.showConfirmDialog(frame, Messages.getString("ListenerCerrarVentana.0"),Messages.getString("ListenerCerrarVentana.1"),JOptionPane.OK_CANCEL_OPTION) == JOptionPane.YES_OPTION){   //$NON-NLS-1$ //$NON-NLS-2$
			System.exit(0);
		}
	}
}
